#include <func.h>

int main(int argc,char **argv)
{
    ARGS_CHECK(argc,3);

    int socketFd;
    socketFd = socket(AF_INET,SOCK_DGRAM,0);//SOCK_DGRAM是udp
    ERROR_CHECK(socketFd,-1,"socket");
    printf("socketFd:%d\n",socketFd);

    struct sockaddr_in ser;
    bzero(&ser,sizeof(ser));
    ser.sin_family = AF_INET;
    ser.sin_port = htons(atoi(argv[2]));
    ser.sin_addr.s_addr = inet_addr(argv[1]);

    char buf[512] = {0};

    fd_set rdset;
    FD_ZERO(&rdset);
    FD_SET(STDIN_FILENO,&rdset);
    FD_SET(socketFd,&rdset);
    while(1)
    {
        int rdyFd = select(2,&rdset,NULL,NULL,NULL);
        if(rdyFd)
        {
            if(FD_ISSET(STDIN_FILENO,&rdset))
            {
                
            }
            else if(FD_ISSET(socketFd,&rdset))
            {}
            else
            {}
        }
    }
    return 0;
}

